var express = require("express");
var router = express.Router();

/* GET users listing. */
router.get("/list", function (req, res, next) {
  // todo get请求用req.query接收参数，post请求使用req.body接收参数
  console.log(req.query);

  // todo 连接数据库，拿到对应的数据
  const list = [
    {
      name: "zhangsan",
      id: 1,
    },
    {
      name: "lisi",
      id: 2,
    },
  ];

  res.json({
    status: 0,
    result: list,
  });
});

router.post("/del", function (req, res, next) {
  console.log(req.body);
  res.json({
    status: 0,
    msg: "删除成功",
  });
});

module.exports = router;
